<template>
	<view>
		<view>
			<uni-nav-bar shadow left-icon="left" dark title="报价详细" @clickLeft="back()" />
		</view>
		
		<view>
		<uni-card>
		<uni-row><text style="font-weight: 600;">编码:</text>{{froms.code}}</uni-row>
		<uni-row><text style="font-weight: 600;">编号:</text>{{froms.number}}</uni-row>
		<uni-row><text style="font-weight: 600;">询价单标题:</text>{{froms.inquiryTitle}}</uni-row>
		<uni-row><text style="font-weight: 600;">询价方式:</text>{{froms.inquiryWay}}</uni-row>
		<uni-row><text style="font-weight: 600;">币种:</text>{{froms.currency}}</uni-row>
		<uni-row><text style="font-weight: 600;">供应商ID:</text>{{froms.supplierId}}</uni-row>
		<uni-row><text style="font-weight: 600;">项目类型:</text>{{froms.projectType}}</uni-row>
		<uni-row><text style="font-weight: 600;">采购员名称:</text>{{froms.purchaserName}}</uni-row>
		<uni-row><text style="font-weight: 600;">截止时间:</text>{{froms.deadline}}</uni-row>
		<uni-row><text style="font-weight: 600;">发布时间:</text>{{froms.releaseTime}}</uni-row>
		<uni-row v-if="froms.quotationStatus==1"><text style="font-weight: 600;">报价参与状态:</text><text style="background-color: gold;border-radius:10rpx;color:#fff;">未参与</text></uni-row>
		
		<uni-row style="text-align: center;">
			<uni-col :span="24"><button type="primary" size="mini" @click="open()">参与</button></uni-col>
		</uni-row>
		
		<view>
			<uni-segmented-control :current="current" :values="items" styleType="button" activeColor="#ffaa00" @clickItem="onClickItem" style="background-color: #fff"  />
		</view>
		
		<view v-if="current === 0">
			<uni-table border stripe >
				<uni-tr style="white-space: nowrap;text-align: center;font-size: 12rpx;">
					<uni-th align="center">序号</uni-th>
					<uni-th align="center">产品名称</uni-th>
					<uni-th align="center">产品型号</uni-th>
					<uni-th align="center">规格</uni-th>
					<uni-th align="center">单位</uni-th>
					<uni-th align="center">数量</uni-th>
					<uni-th align="center">单价</uni-th>
					<uni-th align="center">金额</uni-th>
				</uni-tr>
				<uni-tr v-for="(item,index) in tables" :key="index" style="white-space: nowrap;text-align: center;font-size: 12rpx">
					<uni-td align="center">{{item.materialCode}}</uni-td>
					<uni-td align="center">{{item.materialName}}</uni-td>
					<uni-td align="center">{{item.materialModel}}</uni-td>
					<uni-td align="center">{{item.materialSpecifications}}</uni-td>
					<uni-td align="center">{{item.meterage}}</uni-td>
					<uni-td align="center">{{item.quantity}}</uni-td>
					<uni-td align="center">{{item.unitPrice}}</uni-td>
					<uni-td align="center">{{item.sumPrice}}</uni-td>
				</uni-tr>
			</uni-table>
			
		</view>	
		<view v-if="current === 1">
			<uni-table border stripe >
				<uni-tr style="white-space: nowrap;text-align: center;font-size: 12rpx;">
					<uni-th align="center">报价伦次</uni-th>
					<uni-th align="center">报价单位</uni-th>
					<uni-th align="center">联系人</uni-th>
					<uni-th align="center">联系方式</uni-th>
					<uni-th align="center">产品名称</uni-th>
					<uni-th align="center">规格型号</uni-th>
					<uni-th align="center">客户名称</uni-th>
					<uni-th align="center">报价日期</uni-th>
					<uni-th align="center">数量</uni-th>
					<uni-th align="center">单价</uni-th>
					<uni-th align="center">金额</uni-th>
					<uni-th align="center">供货期/天</uni-th>
					<uni-th align="center">交货地址</uni-th>
					<uni-th align="center">货运方式</uni-th>
					<uni-th align="center">付款方式</uni-th>
					<uni-th align="center">备注</uni-th>
					<uni-th align="center">审核状态</uni-th>
					<uni-th align="center">完结人</uni-th>
				</uni-tr>
				<uni-tr v-for="(item,index) in table" :key="index" style="white-space: nowrap;text-align: center;font-size: 12rpx">
					<uni-td align="center">{{item.turn}}</uni-td>
					<uni-td align="center">{{item.supplierName}}</uni-td>
					<uni-td align="center">{{item.linkmanName}}</uni-td>
					<uni-td align="center">{{item.phone}}</uni-td>
					<uni-td align="center">{{item.materialName}}</uni-td>
					<uni-td align="center">{{item.materialModel}}</uni-td>
					<uni-td align="center">{{item.companyName}}</uni-td>
					<uni-td align="center">{{item.quoteDate}}</uni-td>
					<uni-td align="center">{{item.quantity}}</uni-td>
					<uni-td align="center">{{item.unitPrice}}</uni-td>
					<uni-td align="center">{{item.amount}}</uni-td>
					<uni-td align="center">{{item.supplyPeriod}}</uni-td>
					<uni-td align="center">{{item.deliveryAddress}}</uni-td>
					<uni-td align="center">{{item.deliveryMethod}}</uni-td>
					<uni-td align="center">{{item.deliveryPayment}}</uni-td>
					<uni-td align="center">{{item.remark}}</uni-td>
					<uni-td align="center" v-if="item.status==0"><text style="background-color: darkgreen;border-radius:10rpx;color:#fff;">已驳回</text></uni-td>
					<uni-td align="center" v-if="item.status==1"><text style="background-color:gold;border-radius:10rpx;color:#fff;">待审核</text></uni-td>
					<uni-td align="center" v-if="item.status==2"><text style="background-color: gold;border-radius:10rpx;color:#fff;">已通过</text></uni-td>
					<uni-td align="center">{{item.fixerName}}</uni-td>
				</uni-tr>
			</uni-table>
			
		</view>
		<view v-if="current === 2">
		</view>	
		<view v-if="current === 3">
		</view>
		</uni-card>		  	
		</view>
		
		
		
		
	</view>
</template>

<script>
	import {oMDatatable,qtItemDatatable,quotationEditrowId} from "@/api/system/user"
	export default {
		data() {
			return {
				
				froms:null,
				tables:null,
				table:null,
				current:0,
				items: ['物料列表', '报价轮次','附件列表', '报价须知'],	
			}
		},
		onLoad() {
			const eventChannel = this.getOpenerEventChannel();
			eventChannel.on('acceptDataFromOpenerPage', (data) => {
			  this.froms = data.data
			  this.get()
			})
			
			
		},
		methods: {
			open() {
				uni.navigateTo({
				       url: '/pages/work/supplier/supplier_inquiry_page_list_add',
				       success: (respost) => {
				           // 通过eventChannel向被打开页面传送数据
				           respost.eventChannel.emit('acceptDataFromOpenerPage', {data:this.froms},
						   )}
				     });
					// qtItemaddSave(this.froms.rowId ).then(res=>{
					// 	this.$tab.reLaunch('/pages/work/supplier/supplier_inquiry_page')	
					// })
						
					},
			
		   get(){
			 oMDatatable({inquiryId:this.froms.rowId}).then(res =>{
				 this.tables= res.rows
			 })
			qtItemDatatable({inquiryId:this.froms.rowId}).then(res =>{
				 this.table= res.rows
			 })	
		   },
			back(){
					this.$tab.reLaunch('/pages/work/supplier/supplier_inquiry_page')
			},
			onClickItem(e) {
						if (this.current !== e.currentIndex) {
							this.current = e.currentIndex
						}
					},
		}
	}
</script>

<style>

</style>
